#!/bin/bash

source ~/.bashrc


if [[ $# -eq 0 ]]
then
	op_date=`date +%Y%m%d -d "-1 hour"`
	op_dateTime=`date +%H -d "-1 hour"`
elif [[ $# -eq 2 ]]
then
	op_date=$1
	op_dateTime=$2
else
	echo "sh xx.sh 20150101 03"
fi

sh etl-cashier-desk-hour.sh

inputpath1="/flume/events/dianquan/nginx-collector/$op_date/${op_dateTime}00/*/"
inputpath2="/flume/events/dianquan/nginx-collector/$op_date/${op_dateTime}00/cashier_monitor"
outputpath="/user/hive/warehouse/dianquan.db/dq_cashier_desk_pvuv/dt=${op_date}${op_dateTime}"

remove="$(hdfs dfs -rm -r $outputpath)"
echo "$remove"

result=$(hadoop jar all_0.1.jar com.baidu.mr.EtlCashierMR $inputpath1 $inputpath2 $outputpath $op_date $op_dateTime)
echo "$result"
